/* 
 * File:   EndGame.cpp
 * Author: jose
 * 
 * Created on March 30, 2012, 7:18 PM
 */


//teste 


#include "EndGame.h"
#include "SdlUtils.h"

EndGame::EndGame() {
    font = TTF_OpenFont("lazy.ttf", 28);
}

EndGame::EndGame(const EndGame& orig) {
}

EndGame::~EndGame() {
    delete font;
}


void EndGame::handleEvents(SDL_Event *event){
    
}

void EndGame::processLogic(GameStatus *gameStatus){
    winner = gameStatus->getWinner();
}

void EndGame::render(SDL_Surface *screen) {
    SDL_Color textColor = {132, 43, 200};
    
    SDL_FillRect(screen, &screen->clip_rect, SDL_MapRGB(screen->format, 0xFF, 0xFF, 0xFF));
    
    SDL_Surface *txtWinner;
    if(winner == GameStatus::PLAYER_ONE)
        txtWinner = TTF_RenderText_Solid(font, "Congrulations Player ONE!!!!!", textColor);
    else if(winner == GameStatus::PLAYER_TWO)
        txtWinner = TTF_RenderText_Solid(font, "Congrulations Player TWO!!!!!", textColor);
    else
        txtWinner = TTF_RenderText_Solid(font, "Sorry, it is Tie!!!!!", textColor);
    
    SdlUtils::applySurface(200, 200, txtWinner, screen);
    
}